/* GUI CONVERTED from icloiq.p (converter v1.76) Mon Apr  8 13:49:06 2002 */
/* icloiq.p - LOCATION INQUIRY                                                */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.10 $                                                          */
/*V8:ConvertMode=Report                                                       */
/* REVISION: 1.0      LAST MODIFIED: 04/04/86   BY: EMB   */
/* REVISION: 4.0     LAST EDIT: 12/30/87    BY: WUG *A137* */
/* REVISION: 5.0     LAST EDIT: 05/03/89    BY: WUG *B098* */
/* REVISION: 6.0     LAST EDIT: 05/14/90    BY: WUG *D002* */
/* REVISION: 7.0     LAST EDIT: 11/12/91    BY: flm *F036* */
/* REVISION: 7.0     LAST EDIT: 01/30/92    BY: emb *F114* */
/* REVISION: 7.0     LAST EDIT: 04/09/92    BY: emb *F372* */
/* REVISION: 7.0     LAST EDIT: 09/15/92    BY: pma *F897* */
/* REVISION: 8.5     LAST EDIT: 07/28/95    BY: bholmes *J0FY*/
/* REVISION: 8.6     LAST EDIT: 02/17/98    BY: Beena Mol *K1HP*              */
/* REVISION: 8.6E    LAST MODIFIED: 02/23/98 BY: *L007* A. Rahane             */
/* REVISION: 8.6E    LAST MODIFIED: 10/04/98 BY: *J314* Alfred Tan            */
/* REVISION: 9.1     LAST MODIFIED: 03/24/00 BY: *N08T* Annasaheb Rahane      */
/* REVISION: 9.1     LAST MODIFIED: 08/13/00 BY: *N0KS* Mark Brown            */
/* Old ECO marker removed, but no ECO header exists *F0PN*                    */
/* $Revision: 1.10 $    BY: Jean Miller          DATE: 04/06/02  ECO: *P056*  */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/

/* DISPLAY TITLE */

/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

{mfdtitle.i "b+ "}

define variable loc like loc_loc.
define variable site like loc_site.
define variable w-ext-whl like whl_mstr.whl_src_dest_id.
DEFINE VARIABLE dptdesc  LIKE dpt_desc.
define variable w-loc-site like loc_mstr.loc_site.


/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
   site
   si_desc no-label
   loc
with frame a no-underline width 80 THREE-D /*GUI*/.

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).

{wbrp01.i}

repeat:

   if c-application-mode <> 'web' then
   update site loc
      w-ext-whl
      with frame a
   editing:

      global_site = input site.
      global_loc = input loc.

      if frame-field = "site" then do:
         /* FIND NEXT/PREVIOUS RECORD */
         {mfnp.i si_mstr site si_site site si_site si_site}
         if recno <> ? then do:
            display si_site @ site si_desc with frame a.
         end.
      end.
      else do:
         readkey.
         apply lastkey.
      end.
   end.

   {wbrp06.i &command = update &fields = "  site loc  w-ext-whl"
      &frm = "a"}

   if (c-application-mode <> 'web') or
      (c-application-mode = 'web' and
      (c-web-request begins 'data'))
   then do:
      hide frame b.
      hide frame c.
   end.

   /* OUTPUT DESTINATION SELECTION */
   {gpselout.i &printType = "terminal"
               &printWidth = 80
               &pagedFlag = " "
               &stream = " "
               &appendToFile = " "
               &streamedOutputToTerminal = " "
               &withBatchOption = "no"
               &displayStatementType = 1
               &withCancelMessage = "yes"
               &pageBottomMargin = 6
               &withEmail = "yes"
               &withWinprint = "yes"
               &defineVariables = "yes"}

   w-loc-site = "".

   for each si_mstr no-lock where si_site >= site with frame c:

      /* SET EXTERNAL LABELS */
      setFrameLabels(frame c:handle).

      for each loc_mstr no-lock where
               loc_site = si_site
           and loc_loc >= loc
      break by loc_site by loc_loc
      with frame b width 120:

         /* SET EXTERNAL LABELS */
         setFrameLabels(frame b:handle).
        
         ASSIGN dptdesc = "".
         FIND FIRST dpt_mstr NO-LOCK WHERE dpt_dept = loc_user1  NO-ERROR.
         IF AVAIL dpt_mstr THEN DO:
             ASSIGN dptdesc = dpt_desc.
         END.

         if loc_site <> w-loc-site
         then do with frame b:
            w-loc-site = loc_site.
            display
               si_site
               si_desc no-label
            with frame c side-labels width 120 no-attr-space STREAM-IO /*GUI*/ .
         end.

         find first whl_mstr
            where whl_mstr.whl_site = si_site
            and whl_mstr.whl_loc  = loc_loc
            and (whl_mstr.whl_src_dest_id = w-ext-whl
            or w-ext-whl = "")
         no-lock no-error.

         if not available whl_mstr and w-ext-whl > "" then next.

         display
            loc_loc
            loc_desc format "x(23)"
            loc_status
            loc_date
            loc_perm
            loc_type
            loc_single
            loc__qad01 column-label "Single!Lot"
            loc_user1
            dptdesc
             WITH STREAM-IO /*GUI*/ .

         if available whl_mstr
         then do:
            down 1.
            display
               whl_mstr.whl_src_dest_id @  loc_desc
               whl_mstr.whl_act @ loc_status WITH STREAM-IO /*GUI*/ .
         end.

      end.

      
/*GUI*/ {mfguirex.i  "false"} /*Replace mfrpexit*/


   end.

   {mfreset.i}
/*GUI*/ {mfgrptrm.i} /*Report-to-Window*/

   {pxmsg.i &MSGNUM=8 &ERRORLEVEL=1}

end.

{wbrp04.i &frame-spec = a}
